<?php

class UserBookUsage extends Zend_Db_Table_Abstract {
	
	protected $_primary = "id";
	protected $_name = "user_book_usage";
	
	/**
	 * Find user book usage by id.
	 * 
	 * @param $id
	 */
	public function findById($id) {
		return $this->find($id)->current();
	}
	
	/**
	 * Get usage string from given ids.
	 * 
	 * @param $idStr
	 */
	public static function getUsageStrings($idStr) {
		$ret = array();
		if (!empty($idStr)) {
			$idArr = explode(",", $idStr);
			$index = 0;
			$object = new UserBookUsage();
			foreach ($idArr as $id) {
				$obj = $object->findById($id);
				$ret[$index++] = $obj->usage;
			}
		}
		return $ret;
	}
}
?>